package com.tieto.user.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

import lombok.Data;

import com.tieto.user.dto.User;
import com.tieto.user.service.UserManagement;

@ManagedBean(name = "usersBean")
@RequestScoped
@Data
public class UsersBean {
	@ManagedProperty(value = "#{userManagement}")
	private UserManagement userManagement;
	private Iterable<User> users;

	public Iterable<User> getUsers() {
		if (users == null) {
			users = userManagement.findAll();
		}
		return users;
	}
}
